package org.ch02.test05;

import org.ch02.entity.Student;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

/**
 * @author CSY
 * @date 2025 - 03 - 18
 */
public class MainTest01 {
    public static void main(String[] args) throws Exception {
        Class<Student> clazz = Student.class;

        Field nameField = clazz.getDeclaredField("name");

        //获取字段的访问修饰符
        int modifiers = nameField.getModifiers();

        //判断字段的访问修饰符是否为private
        boolean bl = Modifier.isPrivate(modifiers);
        System.out.println(bl);
    }
}
